import cornerstone from 'cornerstone-core';

export default function(imageIds) {
  const filteredIds = [];
  const filteredLocs = [];
  if (imageIds && imageIds.length > 0) {
    imageIds.forEach(id => {
      const loc = cornerstone.metaData.get('SliceLocation', id);
      if (filteredLocs.findIndex(fLoc => fLoc === loc) < 0) {
        filteredLocs.push(loc);
        filteredIds.push(id);
      }
    });
  }
  return filteredIds;
}
